<include file="public@header"/>
</head>
<body>
<div class="wrap">
    <if condition="isset($data)">
        <h1>始祖编辑</h1>
        <else/>
        <h1>始祖添加</h1>
    </if>
    <form class="form" method="post" action="">
        <div class="form-group">
            <label for="name">名</label>
            <input type="text" class="form-control" id="name" name="name" maxlength="30" value="{:isset($data)?$data.name:''}">
        </div>
        <div class="form-group">
            <label for="styleName">字</label>
            <input type="text" class="form-control" id="styleName" name="style_name" maxlength="30" value="{:isset($data)?$data.style_name:''}">
        </div>
        <div class="form-group">
            <label for="description">描述</label>
            <textarea class="form-control" id="description" row="3" name="description">{:isset($data)?$data.description:''}</textarea>
        </div>
        <div class="form-group">
            <label for="clan">房族</label>
            <select name="clan_id" id="clan" class="form-control">
                <option value="">请选择...</option>
                <option value="0" <if condition="isset($data) && $data.clan_id==0">selected="selected"</if>>无</option>
                <foreach name="clan_tree" item="vo">
                    <option value="{$vo.id}" <if condition="isset($data) && $data.clan_id==$vo.id">selected="selected"</if>><for start="0" end="$vo.level">|-</for>{$vo.name}</option>
                </foreach>
            </select>
        </div>
        <button class="btn btn-primary" type="submit">确定</button>
    </form>
</div>
<script src="http://static.runoob.com/assets/jquery-validation-1.14.0/dist/jquery.validate.min.js"></script>
<script type="application/javascript" language="javascript">
    $().ready(function() {
        $("#form").validate({
            rules:
            {
                name: "required",
                clan_id:"required"
            },
            messages:
            {
                name: "请输入房族名称",
                clan_id:"请选择房/族"
            }
        });
    });
</script>
</body>
</html>